<template>
  <div class="integral" ref="fullHomePage">
    <nav-top title="积分账户" :goback="true"></nav-top>
    <a class="goto-list" href="/" v-show="false">明细</a>
    <div class="top">
      <p class="integral-label">账户积分</p>
      <p class="integral-sum">{{ member.point }}</p>
    </div>
    <p class="rule-label">积分规则</p>
    <div class="rule-value">
      成为会员之后开始获得累计积分的权利；
      <br />每消费1元获得1积分；
      <br />每100积分可在消费的时候抵消1元；
      <br />积分将于评价订单完成到账；
      <br />积分可用于会员续费。
      <br />
    </div>
  </div>
</template>

<script>
import NavTop from "@/components/nav/navBar";
import Axios from 'axios';
import { domain } from '../../api';

export default {
  components: {
    NavTop
  },
  name: "Integral",
  data() {
    return {
      clientHeight: "",
      sum: 10,
      member:{

      }
    };
  },
  created() {
    Axios.get(domain+'/api/member/info')
    .then((res)=>{
      if(res.data.code == 1 ){
        this.member = res.data.data
      }else{
        this.$dialog.alert({ title: res.data.msg, message: res.data.err })
      }
    })
    .catch((err)=>{
      this.$dialog.alert({ title: '提示', message: err })
    })
  },
  mounted() {
    this.clientHeight = `${document.documentElement.clientHeight}`;
    window.onresize = function temp() {
      this.clientHeight = `${document.documentElement.clientHeight}`;
    };
  },
  watch: {
    clientHeight: function() {
      this.changeFixed(this.clientHeight);
    }
  },
  methods: {
    changeFixed(clientHeight) {
      console.log(clientHeight);
      this.$refs.fullHomePage.style.minHeight = clientHeight - 40 + "px";
    }
  }
};
</script>
<style lang='scss' scoped>
.integral {
  margin-top: 40px;
  background: #ffffff;
  .goto-list {
    font-size: 11px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: rgba(255, 255, 255, 1);
    line-height: 1em;
    position: fixed;
    z-index: 210;
    top: 16px;
    right: 14px;
    z-index: 210;
  }
  .top {
    position: relative;
    background-image: url("/static/icon/background-img/top-background.png");
    width: 320px;
    height: 206px;
    background-size: 100% 100%;
    text-align: center;
    p {
      font-family: Microsoft YaHei;
      font-weight: 400;
      color: rgba(251, 251, 251, 1);
      line-height: 1em;
      margin: 0;
    }
    .integral-label {
      font-size: 11px;
      padding-top: 66px;
    }
    .integral-sum {
      font-size: 30px;
      padding-top: 16px;
      font-weight: bold;
    }
  }
  .rule-label {
    font-size: 13px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: rgba(5, 5, 5, 1);
    line-height: 1em;
    margin: 18px 0 0 18px;
  }
  .rule-value {
    font-size: 13px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: rgba(102, 102, 102, 1);
    line-height: 19px;
    margin: 14px 0 0 18px;
    width: 280px;
  }
}
</style>
